package com.asia5b.a5mall.middleware.logic.viewmodel.shop

import androidx.lifecycle.MutableLiveData
import com.asia5b.a5mall.middleware.base.SimpleViewModel
import com.asia5b.a5mall.middleware.model.shop.AbsGoodsModel
import com.asia5b.a5mall.middleware.utils.removeAllOffGoods
import io.reactivex.functions.Consumer

/**
 * Created by zhangyuncai on 2020/1/16.
 */
class ShopTagFragmentVM :SimpleViewModel() {
    /**
     * @Note   加载商品数据
     * @param  tag 标签类型
     * @param  shopId 店铺ID
     */
    fun getFirstGoodsDatas(tag: String, shopId: Int)
    {
        val observable = goodsApi.getTagGoodsList(tag, shopId, 10)
        baseSubscribe(observable, Consumer {resultModel->
//            providerView().getFirstGoodsDatasResult(removeAllOffGoods(resultModel))
            getFirstGoodsDatasResultLiveData.value=removeAllOffGoods(resultModel)
        })
    }
    val getFirstGoodsDatasResultLiveData= MutableLiveData<ArrayList<AbsGoodsModel>>()
}